package com.fan.configserver.service;

import com.fan.configserver.mapper.ResourceEnvMapper;
import com.fan.configserver.po.ResourceEnv;
import com.fan.configserver.po.ResourceEnvExample;
import com.fan.configserver.util.ConvertUtil;
import com.fan.configserver.vo.ResourceEnvVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * java类简单作用描述
 *
 * @Description: java类作用描述
 * @Author: hf
 * @CreateDate: 2018/9/4 15:53
 * @UpdateUser: hf
 * @UpdateDate: 2018/9/4 15:53
 * @UpdateRemark: The modified content
 * @Version: 1.0
 */
@Service
public class ResourceEnvService {
    @Autowired
    ResourceEnvMapper resourceEnvMapper;

    public List<ResourceEnvVo> getAllResourceEnvById(Long resourceId) {
        ResourceEnvExample resourceEnvExample = new ResourceEnvExample();
        ResourceEnvExample.Criteria criteria = resourceEnvExample.createCriteria();
        criteria.andResourceIdEqualTo(resourceId);
        List<ResourceEnv> resourceEnvs = resourceEnvMapper.selectByExample(resourceEnvExample);
        return ConvertUtil.copyTo(resourceEnvs, ResourceEnvVo.class);
    }
}
